package com.appspot.remoteobjects.argo;

public class Field 
{
	public Field()
	{
	}
	
	String name;
	
	java.lang.Class classFromOtherPackage;
	
	Class classFromModel;
	
	boolean needGetter = true;
	
	boolean needSetter = true;
	
	boolean primaryKey = false;
	
	public boolean isPrimaryKey()
	{
		return primaryKey;
	}
	
	public void markAsPrimaryKey()
	{
		this.primaryKey = true;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	public boolean needGetter() {
		return needGetter;
	}

	public void setNeedGetter(boolean needGetter) {
		this.needGetter = needGetter;
	}

	public boolean needSetter() {
		return needSetter;
	}

	public void setNeedSetter(boolean needSetter) {
		this.needSetter = needSetter;
	}

	public java.lang.Class getClassFromOtherPackage() {
		return classFromOtherPackage;
	}

	public void setClassFromOtherPackage(java.lang.Class classFromOtherPackage) {
		this.classFromOtherPackage = classFromOtherPackage;
	}

	public Class getClassFromModel() {
		return classFromModel;
	}

	public void setClassFromModel(Class classFromModel) {
		this.classFromModel = classFromModel;
	}
	
	public String getClassFullName()
	{
		String fullname = "";
		
		if (classFromModel != null)
		{
			fullname += classFromModel.getPackage().getName() + "." + classFromModel.getName();
		}
		else if (classFromOtherPackage != null)
		{
			fullname += classFromOtherPackage.getName();
		}
		else	
		{
			fullname += "java.lang.Object";
		}
		
		return fullname;
	}
}
